﻿@model S4Store.Models.Decorate.PackageCarSaleHistoryModel
@{
    Layout = null;
    ViewBag.Title = "PackageCarSaleHistory";

}
<div style="height:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)
<div style="position:relative; width:100%">
@foreach (var brand in Model.CarBrands)
{
    S4Store.Models.Chart.Line ChartModel = new S4Store.Models.Chart.Line();
    ChartModel.Height = 150;
    ChartModel.Name =brand.Name+"套餐车销售率";
    ChartModel.YAxis = "比例(%)";
    foreach (var m in Model.Reports)
    {
        ChartModel.XAxis.Add(m.Month.ToString("M月"));
    }
    S4Store.Models.Chart.ChartSeries series1 = new S4Store.Models.Chart.ChartSeries();
    series1.Name = "套餐车销售率";
    foreach (var m in Model.Reports)
    {
        var r = m.Reports.FirstOrDefault(t => t.CarBrand.Id == brand.Id);
        if (r != null)
        {
            series1.Data.Add(r.PackageXSLV);
        }
    }
    ChartModel.Serieses.Add(series1);

    S4Store.Models.Chart.ChartSeries series2 = new S4Store.Models.Chart.ChartSeries();
    series2.Name = "套餐车设计率";
    foreach (var m in Model.Reports)
    {
        var r = m.Reports.FirstOrDefault(t => t.CarBrand.Id == brand.Id);
        if (r != null)
        {
            series2.Data.Add(r.PackageCarSJLV);
        }
    }
    ChartModel.Serieses.Add(series2);
    <div style="margin:20px 0">
    @Html.Partial("../Chart/Line", ChartModel);
    </div>
}     
    
</div>
</div>
